<?php
/**
 * Samble
 *
 * Samble main class.
 * 
 * @author Lim Afriyadi
 * @version pre-alpha
 * @package Samble
 * @subpackage core
 * @license GNU/GPL
 */

class Samble extends SambleService
{
    const ERR_HANDLER   = 0;
    const MYSQL         = 1;
    const HTML          = 2;
    const JS            = 3;
    const Session       = 4;
    const SAMBLE_DATE   = 5;
    const XMLRPC_SERVER = 6;
    const XMLRPC_CLIENT = 7;
    const XSLT          = 8;
    
    /**
     * The class Constructor.
     * @final
     */

    private function __CONSTRUCT() { }
    
    /**
     * Get the class instance.
     * @final
     * @return object
     */
    public static final function getInstance()
    {
        if(!self::$o_Instance)
        {
            self::$o_Instance = new Samble();
        }
        return self::$o_Instance;
    }
    /**
     * Initialize and add a framework object into framework array of objects.
     * @param int $c_Object
     */
    public static final function load($c_Object)
    {
        switch($c_Object)
        {
            case self::ERR_HANDLER:
                $ERR_HANDLER = ErrorHandler::getInstance();
                self::$o_Instance->register($ERR_HANDLER);
                break;
            case self::MYSQL:
                $MYSQL = new SDbMySql();
                self::$o_Instance->register($MYSQL);
                break;
            case self::HTML:
                $HTML = new HTML();
                self::$o_Instance->register($HTML);
                break;
            case self::JS:
                $JS = JS::getInstance();
                self::$o_Instance->register($JS);
                break;
            case self::Session:
                $Session = Session::getInstance();
                self::$o_Instance->register($Session);
                break;
            case self::SAMBLE_DATE:
                $SAMBLE_DATE = new SambleDate();
                self::$o_Instance->register($SAMBLE_DATE);
                break;
            case self::XMLRPC_SERVER:
                $XMLRPC_SERVER = Xmlrpc_Server::getInstance();
                self::$o_Instance->register($XMLRPC_SERVER);
                break;
            case self::XMLRPC_CLIENT:
                $XMLRPC_CLIENT = Xmlrpc_Client::getInstance();
                self::$o_Instance->register($XMLRPC_CLIENT);
                break;
            case self::XSLT:
                $XSLT = SAMBLE_XSL::getInstance();
                self::$o_Instance->register($XSLT);
                break;
        }
    }
}
?>
